<template>
    <div id="eventDetail" v-loading="loading">
        <v-tableTitle :btnConfig="btnConfig"
                      :tableSelectData="tableSelectData"
                      :title="'事件明细'"></v-tableTitle>
        <v-table
            :pageSize="pageSize"
            :page="page"
            :tableConfig="tableConfig"
            :tableData="tableData"
            :total="total"
            @findData="getTableData"
            @getTableData="getTableData"
            @searhData="searhData"
            @selectData="selectData"
            @setdialog="setdialog"
            @upData="getTableData"
            ref="table"
        ></v-table>
    </div>
</template>

<script type="text/ecmascript-6">
import tableTitle from "commons/TableTitle";
import table from "commons/Table";
import baseMixin from "@/mixins/BaseMixin";
import config from "./Config";

export default {
    name: "eventDetail",
    mixins: [baseMixin, config],
    data() {
        return {
            loading: false,
            tableConfig: [
                {
                    label: this.$t('bill.invoiceType'),
                    prop: "invoice_type",
                    input: "select",
                    options: this.getOptions("getSelectCode/INVOICE_TYPE/INV_TYPE_DESC/BIC_CODE_INVTYPE/language='zh'")
                },
                {
                    label: this.$t('bill.activity'),
                    prop: "activity_id",
                    input: "input",
                },
                {
                    label: this.$t('bill.chargeCode'),
                    prop: "charge_desc",
                    input: "input",
                },
                {
                    label: "账单计量单位",
                    prop: "bill_uom",
                    input: "select",
                    options: this.getOptions("getSelectCode/UOM_CODE/UOM_DESC/BIC_UOM/1=1")
                },
                {
                    label: this.$t('bill.billTo'),
                    prop: "bill_to_name",
                    input: "input",
                },
                {
                    label: this.$t('security.tier'),
                    prop: "bill_level",
                    input: "select",
                    options: this.getOptions("getSelectCode/BILL_LEVEL/LEVEL_DESC/BIC_CODE_BILLEVEL/language='zh'")
                },
                {
                    label: "特殊",
                    prop: "event_special",
                    input: "select",
                    options: this.getOptions("getSelectCode/EVENT_SPECIAL/SPECIAL_DESC/BIC_CODE_EVENTSPEC/language='zh'")
                },
                {
                    label: "复审费用",
                    prop: "review_flag",
                    input: "select",
                    options: this.getOptions("codelkup/INTLEAVTSK")
                },
                {
                    label: "省略零发货量",
                    prop: "omit_zero_qty",
                    input: "select",
                    options: this.getOptions("codelkup/ISCLOSE")
                },
                {
                    label: "分割",
                    prop: "percent_of_rate",
                    input: "input",
                },
                {
                    label: "期段",
                    prop: "of_period",
                    input: "select",
                    options: this.getOptions("getSelectCode/PERIOD_CODE/PERIOD_DESC/BIC_PERIOD/1=1")
                },
                {
                    label: "宽限频率",
                    prop: "grace_freq",
                    input: "input",
                },
                {
                    label: "宽限期",
                    prop: "grace_period",
                    input: "select",
                    options: this.getOptions("getSelectCode/PERIOD_CODE/PERIOD_DESC/BIC_PERIOD/1=1")
                },
                {
                    label: "重复性账单自",
                    prop: "from_an",
                    input: "input",
                },
                {
                    label: "重复性账单至",
                    prop: "to_an",
                    input: "input",
                },
                {
                    label: "重复项账单处理规则",
                    prop: "recur_code",
                    input: "input",
                },
            ],
            tableData: [],
            pageSize: 10,
          page: 1,
            total: 0,
            tableSelectData: [],
            tableSearhData: {},
            wms: ''
        };
    },
    computed: {
        btnConfig() {
            return []
        }
    },
    created() {
    },
    methods: {
        //选中的内容
        selectData(data) {
            this.tableSelectData = data;
        },
        async getTableData(page, data) {
            try {
                this.loading = true;
                let res = await this.$api.post(`/queryAllEventDetailList/${page}`, data);
                
                    this.tableData = res.page.list;
                  this.page = res.page.curPage;
                    this.pageSize = res.page.pageSize;
                    this.total = res.page.total;
                
            } catch (e) {
                this.$message.error(e);
            } finally {
                this.loading = false;
            }
        },
        //搜索的值
        searhData(data, up) {
            if (!up) {
                this.tableSearhData = data;
            } else {
                this.tableSearhData = data;
                this.getTableData(1, this.tableSearhData);
            }
        },
        //设置弹框
        setdialog(data) {
            this.$store.commit("setRouteData", data);
            this.$router.push({name: 'eventDetailDeawer'});
        },
    },
    mounted() {
        
        this.wms = this.$store.state.wms;
        this.$store.commit("setSkip", {});
        this.$store.commit("setNewFlag", false);
        this.$store.commit("setRouteData", {});
        this.getTableData(1, {});
    },
    watch: {},
    components: {
        "v-tableTitle": tableTitle,
        "v-table": table,
    }
};
</script>

<style scoped>
#eventDetail {
    width: 100%;
    height: 99%;
    padding-top: 6px;
}
</style>
